function export2Csv(csvFilename, csvText, winid) {
    //var displayText = csvText;//.replace(breakDelimiter, "<br>");
    //csvText = csvText.replace(/-\<br\>/, csvDelimiter);
    csvFilename = csvFilename.replace(/ /, "_");
    var csvWin = new Ext.Window({
        title: 'Export2CSV',
        width: 550,
        height: 600,
        id: winid,
        autoScroll: true,
        modal: true,
        bodyStyle: 'padding:2px;',
        items: [
            {
                xtype:'htmleditor',
                id:'csvAreaId',
                value: csvFilename + " saved to your downloads folder<br>You can also copy and paste content below and save it manually<br>"
                        + csvText,
                height:100,
                anchor:'98%'
            }
        ],
        layout: 'fit'
    });
    csvWin.show();
    var tsvform = Ext.getBody().createChild({
        tag: 'form',
        cls: 'x-hidden',
        method: 'POST',
        id: 'form',
        action: '/dudley-lims/sequencing/exportascsv',
        target: 'fileframe'
    });
    tsvform.createChild({
        tag: 'input',
        type: 'hidden',
        name: 'contenttext', // parameter name
        value: encodeURIComponent(csvText) //parameter value
    });
    tsvform.createChild({
        tag: 'input',
        type: 'hidden',
        name: 'filename',
        value: encodeURIComponent(csvFilename)
    });
    tsvform.dom.submit();
}
